
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>Linux服务器使用Nginx搭建Hexo博客+Github Pages | 向🐑</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="linux+Nginx搭建hexo博客，GitHub Pages">
<meta property="og:type" content="article">
<meta property="og:title" content="Linux服务器使用Nginx搭建Hexo博客+Github Pages">
<meta property="og:url" content="https://kziwws.github.io/2018/01/02/technology20180102082133/index.html">
<meta property="og:site_name" content="向🐑">
<meta property="og:description" content="linux+Nginx搭建hexo博客，GitHub Pages">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2018-01-02T00:21:33.000Z">
<meta property="article:modified_time" content="2024-06-03T06:38:47.000Z">
<meta property="article:author" content="kziwws">
<meta property="article:tag" content="CentOS搭建hexo博客">
<meta property="article:tag" content="hexo">
<meta name="twitter:card" content="summary">
  
    <link rel="alternative" href="/atom.xml" title="向🐑" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
<link rel="stylesheet" href="/css/style.css">

  <!--[if lt IE 9]><script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7/html5shiv.min.js"></script><![endif]-->
  <!--  -->
  
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?51e08434b847b38641d02f11be4eb143";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>


<meta name="generator" content="Hexo 4.2.1"></head>
<body>
<div id="container">
  <div id="wrap">
    <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">向🐑</a>
      </h1>
      
        <h2 id="subtitle-wrap">
          <a href="/" id="subtitle">一只站在树上的鸟，从来不害怕树枝突然折断，因为它相信的不是树枝，而是它自己的翅膀！</a>
        </h2>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">首页</a>
        
          <a class="main-nav-link" href="/tags/technology">编程技术</a>
        
          <a class="main-nav-link" href="/tags/poetry">诗</a>
        
          <a class="main-nav-link" href="/tags/life">生活随笔</a>
        
          <a class="main-nav-link" href="/archives">所有文章</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        
        
        <a href="javascript:;" class="popup-trigger nav-icon" id="nav-search-btn"></a>
        
      </nav>
      <div id="search-form-wrap">
        <form action="//www.baidu.com/baidu" method="get" accept-charset="utf-8" class="search-form">
          <input type="search" name="word" maxlength="20" class="search-form-input" placeholder="Search">
          <input type="submit" value="" class="search-form-submit">
          <input name=tn type=hidden value="bds">
          <input name=cl type=hidden value="3">
          <input name=ct type=hidden value="2097152">
          <input type="hidden" name="si" value="kziwws.github.io">
        </form>
      </div>
    </div>
  </div>
  <div class="local-search-inner"><div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <span id="icon-search"></span>
    </span>
    <span class="popup-btn-close">
      <span id="icon-close"></span>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off"
             placeholder="本地搜索..." spellcheck="false"
             type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div></div>
</header>



    <div class="outer">
      <section id="main"><article id="post-technology20180102082133" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2018/01/02/technology20180102082133/" class="article-date">
  <time datetime="2018-01-02T00:21:33.000Z" itemprop="datePublished">2018-01-02</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/hexo/">hexo</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      Linux服务器使用Nginx搭建Hexo博客+Github Pages
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>看了很多搭建博客的 <a href="https://wordpress.org/" target="_blank" rel="noopener">wordpress</a>、<a href="https://ghost.org/" target="_blank" rel="noopener">ghost</a>、<a href="https://jekyllcn.com/" target="_blank" rel="noopener">jekyllcn</a>、<a href="https://hexo.io/zh-cn/index.html" target="_blank" rel="noopener">hexo</a>。这些都可以搭建属于自己的博客，各有各的优点，开始的时候使用了wordpress搭建了一个感觉太弱鸡了。先安装一个 <a href="https://www.bt.cn" target="_blank" rel="noopener">宝塔</a>软件，然后安装wordpress没什么难度，关键定制里面的东西感觉一点都不方便，重点是界面极丑，我感觉自己把主题全部换遍了然后都没有一个我自己觉得满意的，然后我放弃了,不用这个搭建。</p>
<p><strong>然后看了其他很多搭建博客的，后来选择了hexo。</strong></p>
<blockquote>
<p><font color= 'grey'>Hexo 是一个快速、简洁且高效的博客框架。Hexo 使用 Markdown（或其他渲染引擎）解析文章，在几秒内，即可利用靓丽的主题生成静态网页。Hexo的主题样式也有很多好看的，而且github都有star上万的。说明还是很受欢迎的。</font></p>
</blockquote>
<p>如果有人想使用Ghost搭建的轻型博客可以去看一下<a href="https://shevakuilin.com/build-ghost-on-centos7/" target="_blank" rel="noopener">如何在 CentOS 7 上搭建一个 Ghost 博客</a>，朋友就是使用这个搭建的，我选择了hexo我就不去折腾了。</p>
<p>hexo 搭建博客可以采用 </p>
<p>​    1、<a href="https://hexo.io/zh-cn/index.html" target="_blank" rel="noopener">Hexo</a> + <a href="https://pages.github.com/" target="_blank" rel="noopener">Github Pages</a> 的方案，前往<a href="https://github.com" target="_blank" rel="noopener">https://github.com</a>注册一个账号。<br>​    2 、采用 CentOS 搭建在云服务器上，我的是CentOS / 7.6 x64系统，就是Linux操作系统的一个发行版本。</p>
<h4 id="目录"><a href="#目录" class="headerlink" title="目录"></a>目录</h4><ul>
<li><a href="#node_install">Node安装</a></li>
<li><a href="#git_install">Git环境安装</a></li>
<li><a href="#hexo_install">Hexo安装</a></li>
<li><a href="#nginx_install">Nginx配置安装</a></li>
</ul>
<p><strong>如果直接在放在服务器上,可以不用安装git,只是需要安装<code>node</code>、<code>Hexo</code>、<code>nginx</code>。如果使用Github搭建,则需要按照安装。意思就是如果你想要通过git从一个地方提交到远程仓库，就需要安装。</strong></p>
<p>免费的代码存储空间，先去上面的网址注册一个账号，这个账号就是作为博客的网址的前缀，注意这个是不能修改的<code>https://xxx.github.io</code>。由于我都使用工具在云服务器操作的，所以这儿推荐一个Mac系统软件上感觉相对好用的软件 <code>FinalShell SSH工具</code><a href="http://www.hostbuf.com" target="_blank" rel="noopener">简陋的官网</a>，不过我喜欢，就喜欢简单而又直白的…。<a href="http://www.hostbuf.com/downloads/finalshell_install.pkg" target="_blank" rel="noopener">macOs系统版本FinalShell下载</a>，<a href="http://www.hostbuf.com/downloads/finalshell_install.exe" target="_blank" rel="noopener">windows版本FinalShell下载</a>。不过你喜欢用其他也行，只要能连接上服务器就完事。</p>
<p><a name='node_install'><strong>一、配置Node和安装</strong></a></p>
<ul>
<li><a href="https://nodejs.org/en/download/" target="_blank" rel="noopener">官网</a>下载node安装包，下载<a href="https://nodejs.org/dist/v12.14.1/node-v12.14.1-linux-x64.tar.xz" target="_blank" rel="noopener">Linux Binaries (x64) node-v12.14.1-linux-x64.tar.xz includes npm 6.13.4</a> </li>
</ul>
<ul>
<li><p>如果你是使用的Final的话，你自己选择一个node要安装的目录，你也可以新建一个。我的是在主目录新建了一个/soft，然后在命令工具cd /soft 该目录，如果你这儿是想放在其他目录里，你自己cd到要的那个目录里，然后你直接把下载下来的node包拖到这个目录下，就会显示上传。如果你使用的其他工具请自行解决，你也可以使用服务器远程桌面连接，然后在服务上直接下载也行。</p>
</li>
<li><p>使用命令 <code>xz -d node-v12.14.1-linux-x64.tar.xz</code>转为 <code>node-v12.14.1-linux-x64.tar</code>文件 然后<code>tar -xvf node-v10.15.1-linux-x64.tar</code>解压，然后使用删除 <code>rm -rf node-v12.14.1-linux-x64.tar</code>源文件，重命文件夹 <code>mv node-v12.14.1-linux-x64 node</code> 后面好使用。</p>
</li>
<li><p>建立软连接，就是快捷方式就相当于一个入口相当于桌面快捷方式，前面部分就是你先前安装路径 后面是快捷方式路径。</p>
<p><code>ln -s /soft/node/bin/node /usr/local/bin/node</code><br><code>ln -s /soft/node/bin/npm /usr/local/bin/npm</code></p>
</li>
<li><p>使用 <code>npm - v</code>和<code>node - v</code>是否安装成功，如果成功会输出版本号<code>#node -v v12.14.1</code> 和 `#npm -v6.13.4。</p>
<p>找到这个 <code>/usr/local/bin</code> 路径会node和npm的快捷方式，带有绿色的箭头。</p>
</li>
</ul>
<p><a name='git_install'><strong>二、Git环境安装</strong></a></p>
<ul>
<li><p>选择一个目录安装Git，看你自己安装在哪儿。我的是安装到/usr/local目录下,<code>cd /usr/local/git</code>。</p>
</li>
<li><p><a href="https://mirrors.edge.kernel.org/pub/software/scm/git/" target="_blank" rel="noopener">这儿查看git最新版本</a> 或者<a href="https://github.com/git/git/releases" target="_blank" rel="noopener">github上查看</a>，我使用的是<a href="https://github.com/git/git/releases/tag/v2.20.0-rc0" target="_blank" rel="noopener">git v2.20.0-rc0</a>版本，你可以直接下载下来上传到linux环境中。也可以使用命令  <code>wget https://github.com/git/git/archive/v2.20.0-rc0.tar.gz</code>。</p>
</li>
<li><p>下载过后然后解压和上面的步骤一样 <code>tar -zxvf git-v2.20.0-rc0.tar.gz</code>,然后删除<code>rm -rf git-v2.20.0-rc0.tar.gz</code>源文件。</p>
</li>
<li><p>安装依赖包, <code>yum install curl-devel</code>。</p>
<p>开始安装Git   <code>./configure --prefix=/usr/local/git</code> 这儿这个/usr/local/git 就儿这个目录是你的git安装目录，之前的解压出来目录是 /usr/local/git-v2.20.0-rc0 。</p>
<p>执行 <code>make。</code></p>
<p>再执行完成过后，执行 <code>make install</code>。</p>
<p>建立软连接，和前面的意思一样快捷方式 <code>ln -s /usr/local/git/bin/* /usr/bin/</code>。</p>
<p>查看版本<code>git --version</code></p>
</li>
<li><p>GitHub 添加 <code>SSH key</code>,先看本地是否有<code>cd ~/.ssh</code> 然后再执行<code>ls</code>，存在会显示 id_rsa、id_rsa.pub、know_hosts 三个文件，没有创建 <code>ssh-keygen -t rsa -C &quot;xxx邮箱&quot;</code>，把 “xxx邮箱” 替换成你真实的注册github时的邮箱,然后回车输入两次密码。直接回车为空就行，成功后通过如下命令拷贝 SSH key 的内容 <code>clip &lt; ~/.ssh/id_rsa.pub</code>不过你也可以直接打开然后再复制。然后再github新建的仓库里，用你的用户名命名。创建成功过后打开<code>SSH and GPD Keys</code>然后填入信息和刚才复制的 <code>SSH keys</code>值 ,到这儿github pages配置完成。</p>
</li>
</ul>
<p><a name='hexo_install'><strong>三、Hexo安装</strong></a></p>
<ul>
<li><p>安装 <code>npm install -g hexo-cli</code>,hexo为node的一个模块。</p>
</li>
<li><p>建立hexo 软连接 <code>ln -s /soft/node/bin/node/lib/node_modules/hexo-cli/bin/hexo /usr/local/bin/hexo</code>。</p>
</li>
<li><p><code>cd  /soft/hexo/hexoblog</code>,然后执行 <code>hexo init hexoblog</code>  <code>npm install</code>。</p>
</li>
<li><p>hexoblog目录下会多出来<code>.deploy_git</code>、<code>node_modules</code>、<code>scaffolds</code>、<code>public</code>、<code>source</code>、<code>themes</code>等一些配置文件夹，这儿public就是hexo 执行<code>hexo g</code>过后生成的网站根目录，source是编写的Markdown文件资源,themes是hexo博客的一些主题目录。这儿还有一个重要的目录配置文件<code>_config.yml</code>这个就是配置网站里的基础信息。</p>
</li>
<li><p><code>hexo clean</code>、<code>hexo generate、</code> <code>hexo server</code>、 <code>hexo deploy</code> 分别对应简写<code>hexo c、 g 、s 、d</code>，第一个清除所有生成网页文件，第二个生成静态的网页文件，第三个开始启动本地服务器 <code>http://localhost:4000/</code>临时时访问，第四个是生成后立即部署网站。更多指令可以前往<a href="https://hexo.io/zh-cn/docs/commands.html" target="_blank" rel="noopener">hexo官网查看</a>。</p>
</li>
<li><p>这儿public目录下的<code>_config.yml</code>配置如果是使用github+pages 。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">heme: landscape-plus ##这儿默认是landscape主题官方</span><br><span class="line"></span><br><span class="line"># Deployment</span><br><span class="line">## Docs: https://hexo.io/docs/deployment.html</span><br><span class="line">deploy:</span><br><span class="line">  type: git</span><br><span class="line">  repository: git@github.com:xxx/xxx.github.io.git ##这儿换成你github用户名</span><br><span class="line">  branch: master</span><br></pre></td></tr></table></figure>
</li>
<li><p>配置过后就可以<code>hexo s</code>查看<code>hexo d</code>发布到github了。</p>
</li>
</ul>
<p><a name='nginx_install'><strong>四、Nginx配置安装</strong></a></p>
<ul>
<li><p>去<a href="http://nginx.org/en/download.html" target="_blank" rel="noopener">官网下载</a>最新的Nginx安装包<a href="http://nginx.org/download/nginx-1.14.2.tar.gz" target="_blank" rel="noopener">nginx-1.14.2</a>。</p>
</li>
<li><p>上传到服务器 <code>/usr/local</code>,和前面一样的解压，然后 <code>cd /usr/local/ngxin-1.14.2</code>,再执行命令<code>./configure --prefix=/usr/local/nginx-1.14.2</code>。</p>
</li>
<li><p>执行 <code>make</code> ,再执行 <code>make install</code>。</p>
</li>
<li><p>找到安装完成过后的 <code>/usr/local/nginx/sbin/nginx</code>的文件，我这儿把nginx-1.14.2重命名nginx。然后修改nginx的配置。找到路径 /usr/local/nginx/conf/nginx.conf  打开这儿就是一系列的配置。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">server &#123;</span><br><span class="line">      listen       80;#可以修改成其他端口,确定该端口可用</span><br><span class="line">      server_name  localhost;#有域名填写域名</span><br><span class="line">      </span><br><span class="line">      listen <span class="number">443</span> ssl;</span><br><span class="line">      ssl_certificate      server.crt;</span><br><span class="line">      ssl_certificate_key  server_nopwd.key;</span><br><span class="line">      #charset koi8-r;</span><br><span class="line">      #access_log  logs/host.access.log  main;</span><br><span class="line">      location / &#123;</span><br><span class="line">          root   /soft/hexo/nginxblog/<span class="keyword">public</span>; </span><br><span class="line">          #这儿就是你要修改的hexo生成的静态网站目录</span><br><span class="line">          index  index.html index.htm;</span><br><span class="line">      &#125;</span><br><span class="line">      #error_page  404   /404.html;</span><br><span class="line">      # redirect server error pages to the static page /50x.html</span><br><span class="line">      error_page   <span class="number">500</span> <span class="number">502</span> <span class="number">503</span> <span class="number">504</span> <span class="number">404</span> /<span class="number">404</span>x.html;</span><br><span class="line">      location = /<span class="number">404</span>x.html &#123;</span><br><span class="line">          root   html;</span><br><span class="line">      &#125;</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>

<ul>
<li><p>然后启动nginx, <code>/usr/local/nginx/sbin/nginx -s reload</code> 如果有错误的话会提示错误。<code>/usr/local/nginx/sbin/nginx -t</code>会检查nginx配置文件是否正确。<code>/usr/local/nginx/sbin/nginx -s stop</code>快速停止。</p>
</li>
<li><p>如果启动出现<font color='red'>telnet: connect to address ~ no route to host</font> 重新关闭了重启开始出现的话，请先检查端口是否可用，可以使用指令查看 <code>ps -ef | grep nginx</code>  查看nginx端口是否启动成功。<code>netstat -a</code>  查看所有服务端口运行情况。如果还是没有解决，直接关闭防火墙<code>iptables -F</code>，然后再重启nginx。</p>
</li>
<li><p>到这儿如果是80端口的话，你直接在你电脑上输入服务器主ip地址应该就可以看到你的博客界面了。</p>
</li>
</ul>
</li>
</ul>

      
    </div>
    <footer class="article-footer">
      
        <a data-url="https://kziwws.github.io/2018/01/02/technology20180102082133/" data-id="cmhm05vxy005mp4jjafy8gh5i" class="article-share-link" data-share="baidu" data-title="Linux服务器使用Nginx搭建Hexo博客+Github Pages">分享到</a>
      

    
  <a href="https://kziwws.github.io/2018/01/02/technology20180102082133/#valine_thread" class="article-comment-link">评论</a>


      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/hexo/" rel="tag">hexo</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/technology/" rel="tag">technology</a></li></ul>

    </footer>
  </div>
  
    <!-- 
<nav id="article-nav">
  
    <a href="/2018/01/19/technology20180119010121/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">下一篇</strong>
      <div class="article-nav-title">
        
          使用码云gitee搭建Hexo博客
        
      </div>
    </a>
  
  
    <a href="/2017/06/12/technology20170612104702/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">上一篇</strong>
      <div class="article-nav-title">IOS关于极光推送JPush不能上报deviceToken的问题</div>
    </a>
  
</nav>
  -->








<nav id="article-nav">
  
    <a href="/2018/01/19/technology20180119010121/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption"><font size="2" color="#708090">下一篇 newer</font></strong>
      <div class="article-nav-title">
        
          <font color="#555">使用码云gitee搭建Hexo博客</font>
        
      </div>
    </a>
  
  
    <a href="/2017/06/12/technology20170612104702/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption"><font size="2" color="#708090">上一篇 older</font></strong>
      <div class="article-nav-title"><font color="#555">IOS关于极光推送JPush不能上报deviceToken的问题</font></div>
    </a>
   
</nav>


  
</article>

  <section id="comments">
    <div id="valine_thread">
      <div class="comment"></div>
    </div>
  </section>
</section>
      
      <aside id="sidebar">
  
    
<div class="widget-wrap">
  <h3 class="widget-title">关于</h3>
  <ul class="widget about-me">
    
    <li><img class="author" title="About me" src="/img/github.png" /></li>
    
    
    <li ><font color="#424242" size="2em">苹果应用软件开发 & 游戏软件开发</font></li>
    
    <li ><font color="#424242" size="2em">email: ggb.chen@foxmail.com</font></li>
    
  </ul>
</div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">分类</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/charles/">charles</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/cocoapods/">cocoapods</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/cocosCreator/">cocosCreator</a><span class="category-list-count">8</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/error/">error</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/flutter/">flutter</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/git/">git</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/hexo/">hexo</a><span class="category-list-count">5</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/ios/">ios</a><span class="category-list-count">4</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/knowledge/">knowledge</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/python/">python</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/regexp/">regexp</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E8%AF%97/">诗</a><span class="category-list-count">46</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/%E8%AF%97/%E8%AF%97%E6%AD%8C/">诗歌</a><span class="category-list-count">9</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E8%AF%97/%E8%AF%97%E8%AF%8D/">诗词</a><span class="category-list-count">23</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E8%AF%97/%E8%BD%AC%E5%BD%95/">转录</a><span class="category-list-count">1</span></li></ul></li></ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">标签</h3>
    <div class="widget">
      <ul class="tag-list" itemprop="keywords"><li class="tag-list-item"><a class="tag-list-link" href="/tags/android/" rel="tag">android</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/cocoapods/" rel="tag">cocoapods</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/cocosCreator/" rel="tag">cocosCreator</a><span class="tag-list-count">8</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/flutter/" rel="tag">flutter</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/git/" rel="tag">git</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hexo/" rel="tag">hexo</a><span class="tag-list-count">6</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ios/" rel="tag">ios</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/knowledge/" rel="tag">knowledge</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mac/" rel="tag">mac</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/poetry/" rel="tag">poetry</a><span class="tag-list-count">46</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/python/" rel="tag">python</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/regexp/" rel="tag">regexp</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/technology/" rel="tag">technology</a><span class="tag-list-count">29</span></li></ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">标签云</h3>
    <div class="widget tagcloud">
      <a href="/tags/android/" style="font-size: 11.67px;">android</a> <a href="/tags/cocoapods/" style="font-size: 10px;">cocoapods</a> <a href="/tags/cocosCreator/" style="font-size: 16.67px;">cocosCreator</a> <a href="/tags/flutter/" style="font-size: 11.67px;">flutter</a> <a href="/tags/git/" style="font-size: 10px;">git</a> <a href="/tags/hexo/" style="font-size: 15px;">hexo</a> <a href="/tags/ios/" style="font-size: 13.33px;">ios</a> <a href="/tags/knowledge/" style="font-size: 10px;">knowledge</a> <a href="/tags/mac/" style="font-size: 10px;">mac</a> <a href="/tags/poetry/" style="font-size: 20px;">poetry</a> <a href="/tags/python/" style="font-size: 13.33px;">python</a> <a href="/tags/regexp/" style="font-size: 10px;">regexp</a> <a href="/tags/technology/" style="font-size: 18.33px;">technology</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">归档</h3>
    <div class="widget">
      <!--<ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2025/11/">十一月 2025</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2023/09/">九月 2023</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2023/03/">三月 2023</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2023/02/">二月 2023</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2023/01/">一月 2023</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2022/10/">十月 2022</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2022/09/">九月 2022</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2022/01/">一月 2022</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/12/">十二月 2021</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/10/">十月 2021</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/08/">八月 2021</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/11/">十一月 2020</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/05/">五月 2020</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/04/">四月 2020</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/03/">三月 2020</a><span class="archive-list-count">15</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/02/">二月 2020</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/01/">一月 2020</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/12/">十二月 2019</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/10/">十月 2019</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/09/">九月 2019</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/08/">八月 2019</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/07/">七月 2019</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/06/">六月 2019</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/05/">五月 2019</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/03/">三月 2019</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/01/">一月 2019</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/12/">十二月 2018</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/11/">十一月 2018</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/08/">八月 2018</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/07/">七月 2018</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/06/">六月 2018</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/03/">三月 2018</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/02/">二月 2018</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/01/">一月 2018</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/06/">六月 2017</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/12/">十二月 2015</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/02/">二月 2015</a><span class="archive-list-count">5</span></li></ul> -->
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2025/11/">2025年</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2023/09/">2023年</a><span class="archive-list-count">6</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2022/10/">2022年</a><span class="archive-list-count">5</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/12/">2021年</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/11/">2020年</a><span class="archive-list-count">26</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/12/">2019年</a><span class="archive-list-count">13</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/12/">2018年</a><span class="archive-list-count">14</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/06/">2017年</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/12/">2015年</a><span class="archive-list-count">6</span></li></ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">近期文章</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2025/11/05/technology20251105090825/">Sudoku Game Privacy Policy_ Zero Personal Data Collection, Pure Gaming Experience</a>
          </li>
        
          <li>
            <a href="/2023/09/10/technology20230910111821/">Hexo博客部署常见问题及解决方案</a>
          </li>
        
          <li>
            <a href="/2023/03/14/technology20230314101225/">利用python脚本拆解游戏中的图集资源</a>
          </li>
        
          <li>
            <a href="/2023/02/10/technology20230210090112/">利用jekenis自动打包上传阿里云下载和通知钉钉机器人</a>
          </li>
        
          <li>
            <a href="/2023/01/21/technology20230121151206/">IOS项目脚本自动化批量打包并上传第三方平台</a>
          </li>
        
      </ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">友情链接</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="https://github.com/kziwws" target="_blank">github</a>
          </li>
        
          <li>
            <a href="https://shevakuilin.com" target="_blank">shevakuilin</a>
          </li>
        
          <li>
            <a href="https://hans2936.github.io" target="_blank">hans2936</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
      
    </div>
    <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2015 <a href="https://github.com/kziwws" target="_blank">kziwws</a> 
      Powered by hexo,Theme by landscape-plus.
    </div>
    <div id="footer-info" class="inner">
      本站博客采用 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/cn/" target="_blank">[知识共享署名-非商业性使用-相同方式共享 3.0 中国大陆许可协议]</a> 进行许可
    </div>
  </div>
</footer>


<!--
<div id="footer-info" class="inner">
     &copy; 2025 kziwws<br>
      Powered by <a href="//hexo.io/" target="_blank">Hexo</a>
     .
     Theme by <a href="https://github.com/xiangming/landscape-plus" target="_blank">Landscape-plus</a>
   </div>
</div>
-->
  </div>
  <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">首页</a>
  
    <a href="/tags/technology" class="mobile-nav-link">编程技术</a>
  
    <a href="/tags/poetry" class="mobile-nav-link">诗</a>
  
    <a href="/tags/life" class="mobile-nav-link">生活随笔</a>
  
    <a href="/archives" class="mobile-nav-link">所有文章</a>
  
</nav>
  <!-- totop start -->
<div id="totop">
<a title="返回顶部"><img src="/img/scrollup.png"/></a>
</div>

<!-- totop end -->

<!--载入js，在</body>之前插入即可-->
    <!--Leancloud 操作库:-->
    <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
    <!--Valine 的核心代码库-->
    <script src="/js/Valine.min.js"></script>
    <script>
        new Valine({
            av: AV, 
            el: '.comment',
            app_id: 'zh2N00Qk2UIsu1N8Qfu468TH-gzGzoHsz',
            app_key: 'BJrjTSEoKMfc05OMLWhCzmHk',
            placeholder: '想说点什么...',
            pageSize: 15,
            notify: false,
            verify: false,
        });
    </script>


<!-- 百度分享 start -->

<div id="article-share-box" class="article-share-box">
  <div id="bdshare" class="bdsharebuttonbox article-share-links">
    <a class="article-share-weibo" data-cmd="tsina" title="分享到新浪微博"></a>
    <a class="article-share-weixin" data-cmd="weixin" title="分享到微信"></a>
    <a class="article-share-qq" data-cmd="sqq" title="分享到QQ"></a>
    <a class="article-share-renren" data-cmd="renren" title="分享到人人网"></a>
    <a class="article-share-more" data-cmd="more" title="更多"></a>
  </div>
</div>
<script>
  function SetShareData(cmd, config) {
    if (shareDataTitle && shareDataUrl) {
      config.bdText = shareDataTitle;
      config.bdUrl = shareDataUrl;
    }
    return config;
  }
  window._bd_share_config={
    "common":{onBeforeClick: SetShareData},
    "share":{"bdCustomStyle":"/css/bdshare.css"}
  };
  with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='//bdimg.share.baidu.com/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)];
</script>

<!-- 百度分享 end -->

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>


  
<link rel="stylesheet" href="/fancybox/jquery.fancybox.css">

  
<script src="/fancybox/jquery.fancybox.pack.js"></script>




<! -- mathjax config similar to math.stackexchange -->

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
                processEscapes: true
                    
}
  
        });
</script>

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
            skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
                  
}
    
        });
</script>

<script type="text/x-mathjax-config">
MathJax.Hub.Queue(function() {
            var all = MathJax.Hub.getAllJax(), i;
            for(i=0; i < all.length; i += 1) {
                            all[i].SourceElement().parentNode.className += ' has-jax';
                                    
            }
                
        });
</script>

<script type="text/javascript" src="//cdn.bootcss.com/mathjax/2.5.3/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>



<script src="/js/script.js"></script>


</div>

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="icon-search"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.local-search-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url);
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content
                  
                  var upperBound = parseInt('-1');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><span id="icon-search"></span></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><span id="icon-frown"></span></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }
          
          if ('auto' === 'auto') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>
</body>
</html>

